

#pragma once

#include "OpenGL.h"

class GLcamera
{
public:
	GLcamera(void);
	~GLcamera(void);

	GLmat4f m_view;
	
	GLvec3f m_up;
	GLvec3f m_translate;
	GLvec3f m_rotate;

	GLvec3f m_next_move;
	
	float m_speed_pan[2];
	float m_speed_rotate[3];
	float m_speed_fw;
	float m_speed_lr;
	float m_speed_ud;

	void YawPitchRoll( float pitch,float yaw,float roll );

	void GetRotateMatrix( GLmat4f& m );
	GLmat4f GetBillboardMatrix();

	void Stride(float step);
	void Advance( float step );
	void Raise( float step );
	void Pan( float x,float y );

	void MoveBackward();
	void MoveForward();
	void StrideLeft();
	void StrideRight();
	
	GLvec3f GetNextMove(){return m_next_move;}
	GLvec3f GetNextPosition(){ GLvec3f v = m_translate; v.Add(m_next_move);v.Negative();return v;}
	void PreMove( GLvec3f mov );
	void Move( GLvec3f mov );

	float GetAdvanceStepLen(){return m_speed_fw;}
	float GetStrideStepLen(){return m_speed_lr;}
	float GetRaiseStepLen(){return m_speed_ud;}

	void Update();

	GLvec3f GetPosition();
};
